﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Code.Models;

namespace Code.BLL
{
    public class NewsManage:ManageBase<New>
    {
        /// <summary>
        /// 发布新闻
        /// </summary>
        /// <param name="_new"></param>
        /// <returns></returns>
        public int Add(New _new)
        {
            int rs = 0;
            rs = base.Insert<New>(new { _new.Title, _new.Content, _new.State, _new.Language, _new.Highlight });
            return rs;
        }

        /// <summary>
        /// 编辑新闻
        /// </summary>
        /// <param name="_new"></param>
        /// <returns></returns>
        public int Edit(New _new)
        {
            int rs = 0;
            rs = base.Update<New>(new { _new.Title, _new.Content, _new.State, _new.Language, _new.Highlight }, new { _new.ID });
            return rs;
        }

        /// <summary>
        /// 删除新闻
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public int Del(params long[] ids)
        {
            int rs = 0;
            rs = base.Delete<New>(new { ID = new ComparValue(Comparison.In, ids) });
            return rs;
        }
    }
}
